import { defineStore } from 'pinia'
import { routesToMenuTree } from '@/utils'
import asyncRoutes from '@/router/asyncRoutes'

export const useMenuInfoStore = defineStore({
    id: 'menuInfo',
    state: () => {
        return {
            // 菜单列表
            menuList: routesToMenuTree(asyncRoutes),
            // 当前选中的菜单
            activeMenuItem: '/',
        }
    },

    getters: {},
    actions: {
        setActiveMenuItem(data) {},
    },
    persist: {
        enabled: true,
        // keys: ['menuList, activeMenuItem'],
        encryptionKey: 'menuInfo',
        strategies: [{
            key: 'menuInfo',
            storage: sessionStorage,
        }, ],
    },
})